第 5 步:这很容易,对吧?但是如果我们希望用户控制星星的数量和颜色会怎样呢?
- 让我们创建一个名为get_user_input的函数。它将返回用户指定的星星的数量和颜色。
- 在,将Define Function with Docstring def · handle_user_errors()上方: .
- 将my_function重命名为get_user_input 。
- 最后,将您的文档字符串更改为以下内容: """ Gets the user's input from the console """
To navigate the page using the TAB key, first press ESC to exit the code editor.